namespace Crux.Core.Websockets;
/// <summary>
/// WebSocketOptionsOfT
/// </summary>
public class WebSocketOptions<THandler>
    where THandler : WebSocketHandler
{
    /// <summary>
    /// buffer大小
    /// </summary>
    public int BufferSize { get; set; } = 4 * 1024;
    /// <summary>
    /// 服务器名称
    /// </summary>
    public string ServerName { get; init; } = GenerateServerName();
    /// <summary>
    /// 获取当前的服务器名称
    /// </summary>
    private static string GenerateServerName() => $"{Environment.MachineName}_{Guid.NewGuid():N}";
    /// <summary>
    ///
    /// </summary>
    internal WebSocketOptions Options => new WebSocketOptions
    {
        BufferSize = BufferSize,
        ServerName = ServerName
    };
}